/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package diagram;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyVetoException;
import javax.swing.JOptionPane;

/**
 *
 * @author Roderick
 */
public class ZoomAction implements ActionListener {

        protected double amount;
        protected ZoomPanel zp;

        public ZoomAction(ZoomPanel zp, double amount) {
            this.amount = amount;
            this.zp = zp;
        }

        public void actionPerformed(ActionEvent e) {
            try {
                zp.setZoom(zp.getZoom() + amount);
            } catch (PropertyVetoException ex) {
                JOptionPane.showMessageDialog
                    ((Component) e.getSource(),
                     "Couldn't change zoom: "+ex.getMessage());
            }
        }
    }
